import { onlyAlarm } from '@/utils/notification'
import axios from 'axios'

const tempAxios = axios.create({
  baseURL: import.meta.env.VITE_BASE_NODE_URL,
  timeout: 1000,
})

function sendAlarm(text: string) {
  // axios get调用127.0.0.1:3000/send?message=${text}
  tempAxios.get(`/send?message=${text}`)
}

export function alarmProcessor(alarm: number) {
  if (alarm == 0) sendAlarm('0')
  if (alarm == 1) sendAlarm('1')
  if (alarm == 2) sendAlarm('2')

  onlyAlarm()
}
